package cn.tedu.medicalpath.employee.controller;

import cn.tedu.medicalpath.base.response.JsonResult;
import cn.tedu.medicalpath.employee.pojo.vo.AuthorityArrVO;
import cn.tedu.medicalpath.employee.pojo.vo.AuthorityListVO;
import cn.tedu.medicalpath.employee.service.AuthorityListService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/v1/authorityList")
@Slf4j
public class AuthorityListController {

    @Autowired
    private AuthorityListService authorityListService;

    @GetMapping("select/{roleId}/{name}")
    public JsonResult select(@PathVariable("roleId") Integer roleId, @PathVariable("name")String name) {
        log.debug("开始处理【查询角色权限列表】的请求，参数：{},{}", roleId,name);
        Map<String, AuthorityArrVO[]> routeMap = authorityListService.selectByRoleId(roleId,name);
        return JsonResult.success(routeMap);
    }

}
